<?php /** Template Name: Jobs */ get_header(); ?>
<link rel="stylesheet" type="text/css" href="<?php bloginfo('template_directory'); ?>/css/style.css">
<script src="<?php bloginfo('template_directory'); ?>/js/filter/modernizr.js"></script>

    <div id="jobs" class="main">
        <!--<div class="pageTitle">
            <h1 class="effect-title"><span>JOBS</span></h1>
            <h4 class="effect-title"><span>應徵工作</span></h4>
        </div>-->
        <div class="cd-main-content">
            <div class="cd-tab-filter">
                <div>
                    <div class="cd-select cd-filters">
                        <div>
                        <?php if(qtrans_getLanguage()=='tw'): ?>
                            類別
                        <?php endif; ?>
                        <?php if(qtrans_getLanguage()=='en'): ?>
                            Category
                        <?php endif; ?>
                        <?php if(qtrans_getLanguage()=='zh'): ?>
                            类别
                        <?php endif; ?>
                        </div>
                        <select class="filter" name="selectThis" id="selectThis">
                            <option value="">
                                <?php if(qtrans_getLanguage()=='tw'): ?>
                                    全部
                                <?php endif; ?>
                                <?php if(qtrans_getLanguage()=='en'): ?>
                                    All
                                <?php endif; ?>
                                <?php if(qtrans_getLanguage()=='zh'): ?>
                                    全部
                                <?php endif; ?>
                            </option>
                             <?php $terms = get_terms("jobscat");  
                             $count = count($terms);  
                             if($count > 0)  
                                 {   
                                     foreach ($terms as $term)   
                                         {  
                                             echo '<option value=".'.$term->slug.'">'.$term->name.'</option>';  
                                         }  
                                 }  ?> 
                        </select>
                    </div> <!-- cd-select -->
                    <div class="cd-select cd-filters">
                        <div>
                            <?php if(qtrans_getLanguage()=='tw'): ?>
                                職位
                            <?php endif; ?>
                            <?php if(qtrans_getLanguage()=='en'): ?>
                                Position
                            <?php endif; ?>
                            <?php if(qtrans_getLanguage()=='zh'): ?>
                                职位
                            <?php endif; ?>
                        </div>
                        <select class="filter" name="selectThis" id="selectThis">
                            <option value="">
                                <?php if(qtrans_getLanguage()=='tw'): ?>
                                    全部
                                <?php endif; ?>
                                <?php if(qtrans_getLanguage()=='en'): ?>
                                    All
                                <?php endif; ?>
                                <?php if(qtrans_getLanguage()=='zh'): ?>
                                    全部
                                <?php endif; ?>
                            </option>
                             <?php $terms = get_terms("jobsposition");  
                             $count = count($terms);  
                             if($count > 0)  
                                 {   
                                     foreach ($terms as $term)   
                                         {  
                                             echo '<option value=".'.$term->slug.'">'.$term->name.'</option>';  
                                         }  
                                 }  ?> 
                        </select>
                    </div> <!-- cd-select -->
                    <div class="cd-select cd-filters">
                        <div>
                            <?php if(qtrans_getLanguage()=='tw'): ?>
                                地區
                            <?php endif; ?>
                            <?php if(qtrans_getLanguage()=='en'): ?>
                                Location
                            <?php endif; ?>
                            <?php if(qtrans_getLanguage()=='zh'): ?>
                                地区
                            <?php endif; ?>
                        </div>
                        <select class="filter" name="selectThis" id="selectThis">
                            <option value="">
                                <?php if(qtrans_getLanguage()=='tw'): ?>
                                    全部
                                <?php endif; ?>
                                <?php if(qtrans_getLanguage()=='en'): ?>
                                    All
                                <?php endif; ?>
                                <?php if(qtrans_getLanguage()=='zh'): ?>
                                    全部
                                <?php endif; ?>
                            </option>
                             <?php $terms = get_terms("jobslocation");  
                             $count = count($terms);  
                             if($count > 0)  
                                 {   
                                     foreach ($terms as $term)   
                                         {  
                                             echo '<option value=".'.$term->slug.'">'.$term->name.'</option>';  
                                         }  
                                 }  ?> 
                        </select>
                    </div> <!-- cd-select -->
                </div>
            </div> <!-- cd-tab-filter -->
            <section class="cd-gallery">
                <ul>
                <?php $mypost = array( 'post_type' => 'type_jobs');
                $loop = new WP_Query( $mypost ); ?>
                <?php  if ( have_posts() ) : while ( $loop->have_posts() ) : $loop->the_post();?>
                    <li class="mix <?php $terms = get_the_terms( $post->ID, 'jobscat', "fields=names") ;$count = count($terms);if($count > 0) {foreach ($terms as $term){echo $term->slug.' , ';}} ?> <?php $terms = get_the_terms( $post->ID, 'jobsposition', "fields=names") ;$count = count($terms);if($count > 0) {foreach ($terms as $term){echo $term->slug.' , ';}} ?> <?php $terms = get_the_terms( $post->ID, 'jobslocation', "fields=names") ;$count = count($terms);if($count > 0) {foreach ($terms as $term){echo $term->slug.' , ';}} ?> ">
                        <div>
                        <div class="info col-xs-12 col-md-5">
                            <div class="header col-xs-12 col-md-12">
                                <div class="logo">
                                    <?php echo get_image('jobs_setting_logo'); ?>
                                </div>
                                <div class="title">
                                    <h6>
                                        <span>
                                        <?php if(qtrans_getLanguage()=='tw'): ?>
                                            產業
                                        <?php endif; ?>
                                        <?php if(qtrans_getLanguage()=='en'): ?>
                                            Industry
                                        <?php endif; ?>
                                        <?php if(qtrans_getLanguage()=='zh'): ?>
                                            行业
                                        <?php endif; ?> 
                                        </span>
                                        <span>
                                            <?php $terms = get_the_terms( $post->ID, 'jobscat', "fields=names") ;$count = count($terms);if($count > 0) {foreach ($terms as $term){echo $term->name;}} ?>
                                        </span>
                                    </h6>
                                    <h6>
                                        <span>
                                        <?php if(qtrans_getLanguage()=='tw'): ?>
                                            職位
                                        <?php endif; ?>
                                        <?php if(qtrans_getLanguage()=='en'): ?>
                                            Position
                                        <?php endif; ?>
                                        <?php if(qtrans_getLanguage()=='zh'): ?>
                                            职位
                                        <?php endif; ?> 
                                        </span>
                                        <span>
                                            <?php $terms = get_the_terms( $post->ID, 'jobsposition', "fields=names") ;$count = count($terms);if($count > 0) {foreach ($terms as $term){echo '<b>'.$term->name.'</b>';}} ?>
                                        </span>
                                    </h6>
                                    <h6>
                                        <span>
                                            <?php if(qtrans_getLanguage()=='tw'): ?>
                                                地區
                                            <?php endif; ?>
                                            <?php if(qtrans_getLanguage()=='en'): ?>
                                                Location
                                            <?php endif; ?>
                                            <?php if(qtrans_getLanguage()=='zh'): ?>
                                                地区
                                            <?php endif; ?>
                                        </span>
                                        <span>
                                            <?php $terms = get_the_terms( $post->ID, 'jobslocation', "fields=names") ;$count = count($terms);if($count > 0) {foreach ($terms as $term){
                                    echo $term->name.'<b></b>';}} ?>
                                        </span>
                                    </h6>
                                </div>
                            </div>
                            <div class="desc col-xs-12 col-md-12">
                                <?php the_content(); ?>
                            </div>
                            <a href="<?php echo get_post_meta($post->ID, "jobs_setting_link", $single = true) ?>" target="_blank" class="more"><i class="icon-plus"></i></a>
                        </div>
                        <div class="thumb col-xs-12 col-md-7">
                            <a href="<?php echo get_post_meta($post->ID, "jobs_setting_link", $single = true) ?>" target="_blank" class="more" style="background-image:url('<?php $src = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID),  false, '' ); echo $src[0]; ?>')"></a>
                        </div>
                        </div>
                    </li>
                    <?php endwhile; endif; ?>
                </ul>
                <div class="cd-fail-message">No results found</div>
            </section> <!-- cd-gallery -->
        </div>
    </div>
<?php get_footer(); ?>
